<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="header.jsp" %>
</head>
<body>
<div class="easyui-layout" fit="true">
	<div region="center" split="true">
		<div>
			<c:forEach items="${parents }" var="parent">${parent.name==''?'':'&gt;' }<a href="javascript:void(0);" onclick="updateTab('explorer.html?path=${parent.path }');" class="easyui-linkbutton" plain="true">${parent.name==''?fn:substring(parent.path,0,2):parent.name }</a></c:forEach>
		</div>
		<table width="100%">
			<tr>
				<td>
					<c:forEach items="${roots }" var="root"><a href="javascript:void(0);" onclick="updateTab('explorer.html?path=${root.path }');" class="easyui-linkbutton" plain="true">[${fn:substring(root.path,0,2) }]</a></c:forEach>
						<a href="javascript:void(0);" onclick="upload('${path}');" iconCls="icon-redo" class="easyui-linkbutton easyui-tooltip" title="<fmt:message key="admin.upload.desc"/>" plain="true"><fmt:message key="admin.upload"/></a>
					<!-- 文件上传开始 -->
					<iframe id="uploadFrame" name="uploadFrame" src="upload.html" style="display:none;"></iframe>
					<!-- 文件上传结束 -->
				</td>
				<td align="right">
					<input type="text" id="filename" name="filename" class="combo-text" value="${filename }"/>
					<a href="javascript:void(0)" onclick="searchFile('${path}',$('#filename').val());" class="easyui-linkbutton" iconCls="icon-search"><fmt:message key="admin.search"/></a>
				</td>
			</tr>
		</table>
		<table id="files" class="easyui-datagrid" border="0" fitColumns="true" singleSelect="false" autoRowHeight="true" pagination="false" rownumbers="true" remoteSort="false" striped="true">  
		    <thead>  
		        <tr>  
		            <th field="path" sortable="true" checkbox="true"></th>  
		            <th field="name" sortable="true"><fmt:message key="admin.filename"/></th>
		            <th field="size" sortable="true"><fmt:message key="admin.filesize"/></th>
		            <th field="directory" sortable="true"><fmt:message key="admin.folder"/></th>
		            <th field="hidden" sortable="true"><fmt:message key="admin.hidden"/></th>
		            <th field="lastmodify" sortable="true"><fmt:message key="admin.modifytime"/></th>
		            <th field="controlType" sortable="true"><fmt:message key="admin.control"/></th>
		        </tr> 
		    </thead>
		    <tbody>
		        <c:forEach items="${files}" var="file">
		        <tr>
		        	<td checkbox="true">${file.path }</td>
		        	<td>
		        		<c:if test="${file.directory }">
		        			<a href="javascript:void(0);" onclick="updateTab('explorer.html?path=${file.path }');" class="easyui-linkbutton" plain="true">${file.name }</a>
		        		</c:if>
		        		<c:if test="${not file.directory }">
		        			${file.name }
		        		</c:if>
		        	</td>
		        	<td>${file.size }M</td>
		        	<td>${file.directory?folder:requestScope.file }</td>
		        	<td>${file.hidden?hidden:show }</td>
		        	<td>${file.lastmodify }</td>
		        	<td>
		        		<c:if test="${file.directory }"><a href="javascript:void(0);" onclick="zip('<fmt:message key="admin.packaging"/>','${file.path }');" class="easyui-linkbutton" plain="true"><fmt:message key="admin.package"/></a></c:if>
		        		<c:if test="${not file.directory && fn:endsWith(file.name,'.jar') }"><a href="javascript:void(0);" onclick="unzip('<fmt:message key="admin.unpackaging"/>','${file.path }');" class="easyui-linkbutton" plain="true"><fmt:message key="admin.unpackage"/></a></c:if>
		        		<c:if test="${not file.directory }"><a href="download.html?path=${file.path }" class="easyui-linkbutton" plain="true"><fmt:message key="admin.download"/></a></c:if>
		        		<a href="javascript:void(0);" onclick="changeName('<fmt:message key="admin.changeName"/>','<fmt:message key="admin.confirmChangeName"/>','${file.path }');" class="easyui-linkbutton" plain="true"><fmt:message key="admin.changeName"/></a>
		        		<a href="javascript:void(0);" onclick="delFiles('<fmt:message key="admin.delFile"/>','<fmt:message key="admin.confirm"/>','${file.path }');" class="easyui-linkbutton" plain="true"><fmt:message key="admin.delete"/></a>
		        		<c:if test="${file.directory }"><a href="javascript:void(0);" onclick="updateTab('explorer.html?path=${file.path }');" class="easyui-linkbutton" plain="true"><fmt:message key="admin.file.enterDir"/></a></c:if>
		        	</td>
		        </tr>
		        </c:forEach> 
		    </tbody>
		</table>
	</div>
</div>
</body>
</html>